"""
访问可见性

Version: 0.1
Author: yuwl
Date：2024-3-25
"""

class Test:

    # 两个下划线开头属性是私有的
    def __init__(self, foo):
        self.__foo = foo
    
    # 两个下划线开头方法是私有的
    def __bar(self):
        print(self.__foo)
        print('__bar')


def main():
    test = Test('hello')
    # AttributeError: 'Test' object has no attribute '__bar'
    test.__bar()
    # AttributeError: 'Test' object has no attribute '__foo'
    print(test.__foo)

if __name__ == '__main__':
    main()